//
//  ZXRightTableViewCell.swift
//  loveBee
//
//  Created by zhangxing on 2017/8/18.
//  Copyright © 2017年 zhangXing. All rights reserved.
//

import UIKit

class ZXRightTableViewCell: UITableViewCell {
    //icon头像
    @IBOutlet weak var iconImageView: UIImageView!
    //商品名称label
    @IBOutlet weak var nameLabel: UILabel!
    //商品规格label
    @IBOutlet weak var specificationsLabel: UILabel!
    

    //折扣价label
    @IBOutlet weak var discountLabel: UILabel!
    //市场价label
    @IBOutlet weak var marketPriceLabel: UILabel!
    
    
    //增加按钮
    @IBOutlet weak var increaseButton: UIButton!
    
    //减少按钮
    @IBOutlet weak var decreaseButtton: UIButton!
    
    //商品数量label
    @IBOutlet weak var productCountLabel: UILabel!
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }
    
    //接收来自sortController传递过来的ViewModel
    var sortRightCellViewModel: ZXSortRightCellViewModel? {
        
        didSet {
            
            iconImageView.yy_setImage(with: URL.init(string: (sortRightCellViewModel?.sortRightCellModel?.img)!), placeholder: UIImage(named: "v2_placeholder_square"))
            
            nameLabel.text = sortRightCellViewModel?.sortRightCellModel?.name
            
            specificationsLabel.text = sortRightCellViewModel?.sortRightCellModel?.specifics
            
            discountLabel.text = "$" + (sortRightCellViewModel?.sortRightCellModel?.price)!
            
            marketPriceLabel.text = "$" +  (sortRightCellViewModel?.sortRightCellModel?.market_price)!
            
            
            
        }
        
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
}
